<script>
fenleiEffection.type='product';
fenleiEffection.optionString='选择产品分类';

//fenleiEffection.showOrHide=function(){
//
//	return false;
//
//}



function checkForm(){

	$('#centerFlForm').submit();

}



var kuangManagement={

	kuang:new Object(),

	createKuang:function(thisA){

		var thisTishiKuang=getCenterDiv(480,130,175,70,'thisTishiKuang');

		var point=fGetXY(thisA);

		showBack();

		document.getElementsByTagName("body")[0].appendChild(thisTishiKuang);

		$('#thisTishiKuang').css('left','10px');

		$('#thisTishiKuang').css('top','10px');

		$('#thisTishiKuang').fadeIn('slow');

		$('#thisTishiKuang').css('paddingTop','0px');

		$('#thisTishiKuang').css('height','300px');

		this.kuang=thisTishiKuang;

	},

	shutKuang:function(){

		shutBack();

		$(this.kuang).remove();

	}

};



var myCenterDiv={

	headTitle:'',

	action:'',

	centerString:'',

	setCenterDiv:function(){



		this.centerString='<div class="centerflDiv" align="left" style="height: 200px;">';

		this.centerString+='<form name="centerFlForm" id="centerFlForm" method="post" action="'+this.action+'">';

		this.centerString+='<div class="headflDiv"><a style="float:right" onclick="kuangManagement.shutKuang();">关闭</a>'+this.headTitle+'<input type="button" value="添加" onclick="addRow()"></div>';
		
		this.centerString+='<div class="middleflDiv"><div>尺码：<input type="text" name="product_pattern[]">&nbsp;&nbsp;库存：<input name="product_pattern_stock[]" type="text" /><input type="button" name="del" value="删除" onclick="delDiv(this)"></div></div>';		
		this.centerString+='<div class="tailflDiv"><input onclick="checkForm();" type="button" value="确定" /></div>';
		this.centerString+='';
		this.centerString+='</form>';
		this.centerString+='</div>';

	},

	getCenterDiv:function(){

		this.setCenterDiv();

		return this.centerString;

	}

};



var flManagement={

	alterfl:function(thisA){

		kuangManagement.shutKuang();

		kuangManagement.createKuang(thisA);

		myCenterDiv.headTitle="修改分类";

		myCenterDiv.action="administrator<?=CHOSING_DE?>product<?=CHOSING_DE?>editproductsize";

		kuangManagement.kuang.innerHTML=myCenterDiv.getCenterDiv();

		$('input[name="en_flname"]').val($(thisA).prev().prev().html());

		//$('input[name="flname"]').val($(thisA).prev().html());

                //$('textarea[name="flbody"]').val($(thisA).prev().prev().attr('title'));

                $('textarea[name="flbody"]').val($(thisA).prev().html());

                $('input[name="flname"]').val($(thisA).prev().prev().attr('title'));

                $('select[name="openflag"]').val($(thisA).prev().prev().attr('alt'));               

		var flid=$(thisA).prev().prev().attr('name');

		$('#centerFlForm').append('<input type="hidden" value="'+flid+'" name="flid" />');

	},

	newfl:function(thisA){

		kuangManagement.shutKuang();

		kuangManagement.createKuang(thisA);

		myCenterDiv.headTitle="修改尺码";
		
		var str="";
        $("input[name='itemArray[]']:checkbox").each(function(){ 
            if($(this).attr("checked")){
                str += $(this).val()+","
            }
        })
        str = str.substring(0,str.length-1);
		myCenterDiv.action="administrator<?=CHOSING_DE?>product<?=CHOSING_DE?>editproductsize?itemid="+str;
		kuangManagement.kuang.innerHTML=myCenterDiv.getCenterDiv();	

		if($(thisA).attr('name')=='root'){

			var flid=0;

		}else{

			//$('input[name="flname_cn"]').val($(thisA).prev().prev().html());

			var flid=$(thisA).prev().prev().prev().attr('name');

		}

		$('#centerFlForm').append('<input type="hidden" value="'+flid+'" name="flid" />');

	},

};





</script>
<style>
.headflDiv{

	background:url(html/images/topicsbg.gif) repeat-x bottom;

	height:25px;

	padding:5px 5px 0px 5px;

	text-align:left;

}

.middleflDiv{

	padding:10px;

	

}
</style>

<div class="frame_productDiv">
	<div style="width:99%">
		<div id="productLeft">
			<div class="bigChildDiv"><a onclick="productEffection.is_showed='';fenleiEffection.boldOrNormal(this,0);">所有产品</a></div>
			<?=$this->fenleiString?>
		</div>
		<div id="productRight">
		<script>productEffection.showAll(<?=$this->page?>,<?=$this->flid?>);</script>
		</div>
		<div class="clearthis">.</div>
		<div class="adminSearchDiv">
			<div>时间 ： <input name="time_from" /> - <input name="time_to" /></div>
			<div>卖家 ： <input name="seller" /></div>
			<div>金额 ： <input name="min_price" /> - <input name="max_price" /></div>
			<div>关键字：<input name="keyword" /></div>
			<div>
				类型 ： 
				<select name="type">
					<option value="">选择类型</option>
					<option value="1">最热</option>
					<option value="2">最新</option>
					<option value="3">推荐</option>
					<option value="isTop">置顶</option>
					<option value="0">无</option>
				</select>
			</div>
			<div><button onclick="productEffection.product.setParam();productEffection.showAll('1','0')">搜索</button>
		</div>
	</div>
</div>
<script>
$('#productLeft a').click(
	function(){
		productEffection.searchQuery='';
	}
);
function editSize(_this){
	var thisForm=document.getElementById('helpIndexForm');
	var flag=0;
	var inputArray=thisForm.getElementsByTagName('input');
	for(var i=0;i<inputArray.length;i++){
		if(inputArray[i].checked==true){
			flag++;	
		}
	}
	if(flag==0){
		parent.showMsg("No Select！");
		return false;
		
	}
	flManagement.newfl(_this)
	
}
function addRow(){
	$(".middleflDiv").append("<div>尺码：<input type='text' name='product_pattern[]'>&nbsp;&nbsp;库存：<input name='product_pattern_stock[]' type='text' /><input type='button' name='del' value='删除' onclick='delDiv(this)'></div>");
}
function delDiv(_this){
	$(_this).parent().remove();
}
</script>